<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="msg">
        <mycom :parent-value="msg"></mycom>
    </div>

    <template id="temp">
        <!-- template中有且仅能有一个顶级节点 -->
        <div>
            <hr>
            <p>父节点传递过来的元素：{{ parentValue }}</p>
        </div>
    </template>

    <script>
        Vue.component(
            'mycom',
            {
                template: "#temp",
                // 子组件中定义props接收父组件数据
                props: ["parentValue"]
            }
        )
        new Vue({
            el: "#app",
            data: {
                msg: ''
            },
        })
    </script>
</body>
</html>